package com.cyk.mongo_0116.model;

import org.springframework.context.annotation.Profile;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.DataOutputStream;
import java.util.Date;

@Document("demo") //表示当前文档属于哪个集合
public class User {

    @Id //当前类的 id 映射文档中的 _id
    private Integer id;
    private String name;
    private Integer age;
    @Field("work_day")  //当前类的 workDay 映射文档中的 work_day
    private Date workDay;

    public User(Integer id, String name, Integer age, Date workDay) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.workDay = workDay;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", workDay=" + workDay +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Date getWorkDay() {
        return workDay;
    }

    public void setWorkDay(Date workDay) {
        this.workDay = workDay;
    }
}
